using System;
using System.Data;
using System.Collections.Generic;
using System.Text;
using BA.DAL;
using Microsoft.VisualBasic;

namespace BlazeApps.Library.WebServices
{
    public class ServiceItems : Base
    {
        private BA.DAL.DBUtility DAL = new BA.DAL.DBUtility();
        private Procedures Procs = new Procedures();

        public DataSet GetPageResults(string WhereClause, string ItemType)
        {
            DAL.CreateDBObjects(ConnectionString, Provider);

            DAL.AddParameter("@whereclause", WhereClause);
            DAL.AddParameter("@itemtype", ItemType);

            return DAL.GetDataSet(Procs.SearchItems.ToString().Trim(), System.Data.CommandType.Text, System.Data.ConnectionState.Open);
        }

        public DataSet GetPageDetails(Guid PageID)
        {
            DAL.CreateDBObjects(ConnectionString, Provider);

            DAL.AddParameter("@pageid", PageID);

            return DAL.GetDataSet(Procs.GetPageByPageID.ToString().Trim(), System.Data.CommandType.Text, System.Data.ConnectionState.Open);
        }

        public DataSet GetViewerDetails(Guid PageID)
        {
            DAL.CreateDBObjects(ConnectionString, Provider);

            DAL.AddParameter("@pageid", PageID);

            return DAL.GetDataSet(Procs.GetPageViewDetails.ToString().Trim(), System.Data.CommandType.Text, System.Data.ConnectionState.Open);
        }
    }
}
